﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using System.Management.Instrumentation;
using System.Windows.Forms;

namespace BfLib.Sys
{
    public static class SysLib
    {
        public static long GetDiskFreeSpace(char DriveLetter)
        {
            ManagementObject disk = new
            ManagementObject(String.Format("win32_logicaldisk.deviceid=\"{0}:\"", DriveLetter));
            disk.Get();

            return (long)disk["FreeSpace"];
        }

        public static long GetDiskSize(char DriveLetter)
        {
            ManagementObject disk = new
            ManagementObject(String.Format("win32_logicaldisk.deviceid=\"{0}:\"", DriveLetter));
            disk.Get();

            return (long)disk["Size"];
        }
    }
}
